package com.jzo2o.customer.controller.operation;

import com.jzo2o.common.model.PageResult;
import com.jzo2o.customer.model.dto.request.AgencyCertificationAuditPageQueryReqDTO;
import com.jzo2o.customer.model.dto.response.AgencyCertificationAuditResDTO;
import com.jzo2o.customer.service.IAgencyCertificationAuditService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author jianghaijun
 */
@Api(tags = "运营端 - 处理机构认证信息相关接口")
@RestController("operationAgencyCertificationAuditController")
@RequestMapping("/operation/agency-certification-audit")
public class AgencyCertificationAuditController {

    @Resource
    private IAgencyCertificationAuditService agencyCertificationAuditService;

    @ApiOperation("审核机构认证分页查询")
    @GetMapping("/page")
    public PageResult<AgencyCertificationAuditResDTO> page(AgencyCertificationAuditPageQueryReqDTO agencyCertificationAuditPageQueryReqDTO) {
        return agencyCertificationAuditService.page(agencyCertificationAuditPageQueryReqDTO);
    }

    @ApiOperation("审核机构认证信息")
    @GetMapping("/audit/{id}")
    public void audit(@PathVariable("id") Long id,
                      @RequestParam(value = "certificationStatus", required = true) Integer certificationStatus,
                      @RequestParam(value = "rejectReason", required = false) String rejectReason) {
        agencyCertificationAuditService.audit(id, certificationStatus, rejectReason);
    }

}
